// 工具
#pragma once

#include <string>
#include <vector>

class Util
{
public:
    // 通过分隔符截取字符串放进vector
    static void CutString(const std::string& str, const std::string& separator, std::vector<std::string>& v)
    {
        size_t left = 0;
        size_t right = 0;
        while((right = str.find(separator, left)) != std::string::npos)
        {
            if(left != right)
                v.push_back(str.substr(left, right - left)); // 减的第二个参数是len
            left = right + separator.size();
        }
        if(left != str.size())
            v.push_back(str.substr(left, right));
    }
};